<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"mixley.github.io","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="全栈·架构设计·算法">
<meta property="og:type" content="website">
<meta property="og:title" content="mixley">
<meta property="og:url" content="https://mixley.github.io/page/4/index.html">
<meta property="og:site_name" content="mixley">
<meta property="og:description" content="全栈·架构设计·算法">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="mixley">
<meta property="article:tag" content="mixley,前端,后端,全栈,收集,java,人脸识别,架构设计,spring,aop,spring boot,spring cloud,深度学习,vue,杂七杂八">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://mixley.github.io/page/4/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : true,
    isPost : false,
    lang   : 'zh-CN'
  };
</script>

  <title>mixley</title>
  


  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?c36eb18366b436984557126f16796f30";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">mixley</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">求上者得中·求中者得下</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-sitemap">

    <a href="/sitemap.xml" rel="section"><i class="fa fa-sitemap fa-fw"></i>站点地图</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content index posts-expand">
            
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/15DR29D.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/15DR29D.html" class="post-title-link" itemprop="url">安装nginx</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-15 20:14:09" itemprop="dateCreated datePublished" datetime="2021-07-15T20:14:09+08:00">2021-07-15</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-06-06 22:01:48" itemprop="dateModified" datetime="2022-06-06T22:01:48+08:00">2022-06-06</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/operations/" itemprop="url" rel="index"><span itemprop="name">运维</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/operations/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/15DR29D.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/15DR29D.html" class="cy_cmt_count" data-xid="2021/15DR29D.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"><span class="comment">#若在安装jdk时已经配置阿里的yum源，可以跳过下面的步骤，直接到 yum install -y  nginx</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash">nginx的源</span></span><br><span class="line">rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">安装nginx</span></span><br><span class="line">yum install -y  nginx</span><br><span class="line"><span class="meta">#</span><span class="bash">获取nginx目录</span></span><br><span class="line">whereis nginx</span><br></pre></td></tr></table></figure>

<h2 id="常用命令"><a href="#常用命令" class="headerlink" title="常用命令"></a>常用命令</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">启动</span></span><br><span class="line">nginx</span><br><span class="line"><span class="meta">#</span><span class="bash">测试Nginx配置是否正确</span></span><br><span class="line">nginx -t</span><br><span class="line"><span class="meta">#</span><span class="bash">优雅重启</span></span><br><span class="line">nginx -s reload</span><br><span class="line"><span class="meta">#</span><span class="bash">查看服务是否启动</span></span><br><span class="line">ps -ef | grep nginx | grep -v grep</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">防火</span></span><br></pre></td></tr></table></figure>

<h2 id="配置路径"><a href="#配置路径" class="headerlink" title="配置路径"></a>配置路径</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">推荐vim去编辑，vi不提供高亮，yum install vim -y</span></span><br><span class="line">vim /etc/nginx/nginx.conf</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">或者直接在下面目录新建config文件</span></span><br><span class="line">cd /etc/nginx/conf.d/</span><br></pre></td></tr></table></figure>

<h2 id="转发配置"><a href="#转发配置" class="headerlink" title="转发配置"></a>转发配置</h2><figure class="highlight nginx"><table><tr><td class="code"><pre><span class="line"><span class="comment">#TCP 转发</span></span><br><span class="line">stream&#123;</span><br><span class="line">	<span class="attribute">upstream</span> kafka&#123;</span><br><span class="line">		<span class="attribute">hash</span> $remote_addr consistent;</span><br><span class="line">		<span class="attribute">server</span> <span class="number">10.177.43.37:9092</span> max_fails=<span class="number">3</span> fail_timeout=<span class="number">10s</span>; </span><br><span class="line">        <span class="comment">#多一个是负载</span></span><br><span class="line">		<span class="attribute">server</span> <span class="number">10.177.43.37:9093</span> max_fails=<span class="number">3</span> fail_timeout=<span class="number">10s</span>; </span><br><span class="line">	&#125;</span><br><span class="line">	server&#123;</span><br><span class="line">		<span class="attribute">listen</span> <span class="number">9092</span>;</span><br><span class="line">		<span class="attribute">proxy_connect_timeout</span> <span class="number">20s</span>;</span><br><span class="line">		<span class="attribute">proxy_timeout</span> <span class="number">5m</span>;</span><br><span class="line">		<span class="attribute">proxy_pass</span> kafka;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">#HTTP转发</span></span><br><span class="line">server&#123;</span><br><span class="line">  <span class="attribute">listen</span> <span class="number">80</span>;</span><br><span class="line">  <span class="attribute">location</span><span class="regexp"> ^~</span> /bus &#123;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> Host $host;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> X-Real-IP $remote_addr;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> REMOTE-HOST $remote_addr;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> X-Forwarded-For $proxy_add_x_forwarded_for;</span><br><span class="line">        <span class="attribute">proxy_set_header</span> Context-Path /bus;<span class="comment">#这里配合了代码</span></span><br><span class="line">        <span class="comment"># proxy_cookie_path / /bus/;</span></span><br><span class="line">        <span class="attribute">proxy_pass</span> http://10.177.43.36:58080/;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>


      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/1XRQBRM.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/1XRQBRM.html" class="post-title-link" itemprop="url">安装mysql</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-15 20:14:05" itemprop="dateCreated datePublished" datetime="2021-07-15T20:14:05+08:00">2021-07-15</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-03-21 13:50:06" itemprop="dateModified" datetime="2022-03-21T13:50:06+08:00">2022-03-21</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/operations/" itemprop="url" rel="index"><span itemprop="name">运维</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/operations/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/1XRQBRM.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/1XRQBRM.html" class="cy_cmt_count" data-xid="2021/1XRQBRM.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">查看是否安装</span></span><br><span class="line">yum list installed | grep mysql</span><br><span class="line"><span class="meta">#</span><span class="bash">卸载</span></span><br><span class="line">yum -y remove mysql-libs.x86_64</span><br><span class="line"><span class="meta">#</span><span class="bash">查看版本库信息</span> </span><br><span class="line">yum list | grep mysql</span><br><span class="line"><span class="meta">#</span><span class="bash"> 或 查看版本库信息</span></span><br><span class="line">yum -y list mysql*</span><br><span class="line"><span class="meta">#</span><span class="bash">安装mysql客户端</span></span><br><span class="line">yum install mysql -y</span><br><span class="line"><span class="meta">#</span><span class="bash">安装mysql服务端</span></span><br><span class="line">yum install mysql-server -y</span><br><span class="line"><span class="meta">#</span><span class="bash">选装mysql开发库</span></span><br><span class="line">yum install mysql-devel -y</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">或者使用下列命令安装</span></span><br><span class="line">yum -y install mysql-server mysql mysql-devel</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="启动命令"><a href="#启动命令" class="headerlink" title="启动命令"></a>启动命令</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">启动mysql</span></span><br><span class="line">service mysqld start</span><br><span class="line"><span class="meta">#</span><span class="bash">关闭mysql</span></span><br><span class="line">service mysqld stop</span><br><span class="line"><span class="meta">#</span><span class="bash">数据库端口是否开启</span></span><br><span class="line">lsof -i:3306</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">指定用户登录</span></span><br><span class="line">mysqld --user=[username]</span><br></pre></td></tr></table></figure>

<h2 id="异常"><a href="#异常" class="headerlink" title="异常"></a>异常</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">解决root用户无法运行</span></span><br><span class="line">vim /etc/my.cnf</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<p>//离线安装</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">uname -a</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> Linux localhost.localdomain 4.18.0-193.el8.x86_64 <span class="comment">#1 SMP Fri May 8 10:59:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash">el8.x86_64表示8</span></span><br></pre></td></tr></table></figure>

<p>下载地址</p>
<p><a target="_blank" rel="noopener" href="https://downloads.mysql.com/archives/community/">https://downloads.mysql.com/archives/community/</a></p>
<p>el8针对centos8,el7针对centos7</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/xiguashixiaoyu/article/details/108777534">https://blog.csdn.net/xiguashixiaoyu/article/details/108777534</a></p>
<p>密码修改</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">进入mysql</span></span><br><span class="line">mysql -uroot -p</span><br><span class="line"><span class="meta">#</span><span class="bash">切换mysql数据库</span></span><br><span class="line">use mysql;</span><br><span class="line"><span class="meta">#</span><span class="bash">查看root信息</span></span><br><span class="line">SELECT `Host`,`User` FROM user where user=&quot;root&quot;;</span><br><span class="line"><span class="meta">#</span><span class="bash">更新用户表</span></span><br><span class="line">UPDATE user SET `Host` = &#x27;%&#x27; WHERE `User` = &#x27;root&#x27; and host=&#x27;localhost&#x27; LIMIT 1;</span><br><span class="line"><span class="meta">#</span><span class="bash">强制刷新权限：</span></span><br><span class="line">flush privileges;</span><br><span class="line"><span class="meta">#</span><span class="bash">如果仍不可访问，就需要设置访问权限</span></span><br><span class="line">GRANT ALL PRIVILEGES ON *.* TO &#x27;root&#x27;@&#x27;%&#x27; IDENTIFIED BY &#x27;密码&#x27; WITH GRANT OPTION;</span><br><span class="line"><span class="meta">#</span><span class="bash">强制刷新权限：</span></span><br><span class="line">flush privileges;</span><br></pre></td></tr></table></figure>


      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/2YMFT5G.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/2YMFT5G.html" class="post-title-link" itemprop="url">安装jdk</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-14 20:19:49" itemprop="dateCreated datePublished" datetime="2021-07-14T20:19:49+08:00">2021-07-14</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-01-28 20:42:09" itemprop="dateModified" datetime="2022-01-28T20:42:09+08:00">2022-01-28</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/operations/" itemprop="url" rel="index"><span itemprop="name">运维</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/operations/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/2YMFT5G.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/2YMFT5G.html" class="cy_cmt_count" data-xid="2021/2YMFT5G.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p> yum的方式安装dragonwell8（阿里的jdk8版本）</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">进入repos目录</span></span><br><span class="line">cd /etc/yum.repos.d</span><br><span class="line"></span><br><span class="line">vi alinux-plus.repo</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="comment">#alinux-plus.repo中录入下面内容，(i编辑，esc退出，:wq退出并保存)</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> plus packages provided by Aliyun Linux dev team</span></span><br><span class="line">[plus]</span><br><span class="line">name=AliYun-2.1903 - Plus - mirrors.aliyun.com</span><br><span class="line">baseurl=http://mirrors.aliyun.com/alinux/2.1903/plus/$basearch/</span><br><span class="line">gpgcheck=1</span><br><span class="line">gpgkey=http://mirrors.aliyun.com/alinux/RPM-GPG-KEY-ALIYUN</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="comment">#保存完毕后，使用yum命令安装java</span></span></span><br><span class="line">yum install -y java-1.8.0-alibaba-dragonwell</span><br></pre></td></tr></table></figure>

<p><img src="https://mixley.stdcdn.com/2021/07/2cccdfc79185c253a2fca2a876b7fa54.png" alt="image-20210714101550980"></p>
<p>安装完成后，找到对应的安装路径和环境设置的值。并将其录入到环境变量中。</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">此时仅能作用当前会话，需要将其写入到环境变量中</span></span><br><span class="line"><span class="meta">#</span><span class="bash">修改系统配置，没有vim可以使用vi</span></span><br><span class="line">vim /etc/profile</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="comment">#注意路径以安装时路径为准，可在/opt/alibaba中找到对应的安装路径</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="comment">#最后一行输入，在/etc/profile文件中最后一行哦(insert按键或i开启编辑)，esc后 :wq退出保存</span></span></span><br><span class="line">export JAVA_HOME=/opt/alibaba/java-1.8.0-alibaba-dragonwell-8.8.8.302.b1-1.al8</span><br><span class="line">export PATH=$&#123;JAVA_HOME&#125;/bin:$PATH</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 使上面的设置立即生效</span></span><br><span class="line">source /etc/profile</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">输入java -version查看java版本，存在则成功</span></span><br><span class="line">java -version</span><br></pre></td></tr></table></figure>


      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/254DB2D.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/254DB2D.html" class="post-title-link" itemprop="url">卸载edge</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-13 22:24:00" itemprop="dateCreated datePublished" datetime="2021-07-13T22:24:00+08:00">2021-07-13</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-07-15 22:24:08" itemprop="dateModified" datetime="2021-07-15T22:24:08+08:00">2021-07-15</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%B0%8F%E6%8A%80%E5%B7%A7/" itemprop="url" rel="index"><span itemprop="name">小技巧</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/254DB2D.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/254DB2D.html" class="cy_cmt_count" data-xid="2021/254DB2D.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <figure class="highlight powershell"><table><tr><td class="code"><pre><span class="line">.\setup.exe -<span class="literal">-uninstall</span> -<span class="literal">-system</span><span class="literal">-level</span> -<span class="literal">-verbose</span><span class="literal">-logging</span> -<span class="literal">-force</span><span class="literal">-uninstall</span></span><br></pre></td></tr></table></figure>


      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/16VX7F1.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/16VX7F1.html" class="post-title-link" itemprop="url">vscodium使用vscode扩展</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-13 20:01:21" itemprop="dateCreated datePublished" datetime="2021-07-13T20:01:21+08:00">2021-07-13</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%B0%8F%E6%8A%80%E5%B7%A7/" itemprop="url" rel="index"><span itemprop="name">小技巧</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/16VX7F1.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/16VX7F1.html" class="cy_cmt_count" data-xid="2021/16VX7F1.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p> 发现vscodium插件较少时，可以修改插件下载位置，使用微软的插件库 </p>
<p><a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/276000982">https://zhuanlan.zhihu.com/p/276000982</a></p>
<p>vscodium默认使用的扩展源是<code>open-vsx.org</code>，部分扩展没有加入此扩展源，需要使用微软官方扩展源才能直接安装和自动更新。</p>
<p>修改<code>安装根目录/resources/app/product.json</code>文件中的<code>extensionsGallery</code>键对应的值如下：</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">&quot;extensionsGallery&quot;: &#123;</span><br><span class="line">    &quot;serviceUrl&quot;: &quot;https://marketplace.visualstudio.com/_apis/public/gallery&quot;,</span><br><span class="line">    &quot;itemUrl&quot;: &quot;https://marketplace.visualstudio.com/items&quot;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>重启vscodium。扩展里就可以搜索安装微软官方扩展源里的扩展。</p>
<p><img src="https://mixley.stdcdn.com/2021/07/f73850c3c4002c0fab6a47804978b736.png" alt="image-20210713200101052"></p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/1P5AD68.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/1P5AD68.html" class="post-title-link" itemprop="url">快速上传微信素材</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-10 21:12:40" itemprop="dateCreated datePublished" datetime="2021-07-10T21:12:40+08:00">2021-07-10</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-07-12 20:30:59" itemprop="dateModified" datetime="2021-07-12T20:30:59+08:00">2021-07-12</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/tool/" itemprop="url" rel="index"><span itemprop="name">工具</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/1P5AD68.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/1P5AD68.html" class="cy_cmt_count" data-xid="2021/1P5AD68.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p> 当我们编写了博客后，想将博客内容发送到微信公众平台时，会遇到一个新的阻碍：图片需要重新上传。</p>
<p>MD转成微信样式后有很多方式，之前我们提到的<a target="_blank" rel="noopener" href="https://md.openwrite.cn/">md.openwrite.cn</a>，或者直接使用OpenWrite中编辑文章后显示的<strong>公众号预览</strong>功能都能基本满足要求，但是！复制的内容粘贴在微信后，无法解决图片无法加载的问题，功能实用性大打折扣。</p>
<h2 id="理清思路"><a href="#理清思路" class="headerlink" title="理清思路"></a>理清思路</h2><h3 id="失败的素材的处理"><a href="#失败的素材的处理" class="headerlink" title="失败的素材的处理"></a>失败的素材的处理</h3><p>图片不是微信的，会提示失败图片，我们需要通过点击<strong>查看失败图片</strong>找到对应的图片，然后选中失败图片后，点击<strong>图片</strong>-&gt;<strong>本地上传</strong>再从本地选择图片上传，若提前存图片库的，可以从图片库中选择。</p>
<p><img src="https://mixley.stdcdn.com/2021/07/68bbd53c0ed7e3797596e738ad1c8be8.png" alt="失败图片显示"></p>
<h3 id="重复动作梳理"><a href="#重复动作梳理" class="headerlink" title="重复动作梳理"></a>重复动作梳理</h3><p>1、找到失败图片，选中失败图片</p>
<p>2、获取失败图片路径</p>
<p>3、点击图片-&gt;本地上传</p>
<p>4、找到对应失败图片的本地路径</p>
<p>5、点击确定</p>
<h3 id="需要处理的核心问题"><a href="#需要处理的核心问题" class="headerlink" title="需要处理的核心问题"></a>需要处理的核心问题</h3><p>1、通过失败图片路径找到本地路径</p>
<p>2、重复动作太多，需要简化操作</p>
<h2 id="解决问题"><a href="#解决问题" class="headerlink" title="解决问题"></a>解决问题</h2><h3 id="替换图片路径为本地路径"><a href="#替换图片路径为本地路径" class="headerlink" title="替换图片路径为本地路径"></a>替换图片路径为本地路径</h3><p>我们可以uTools的自动化助手，帮我们将图片下载，然后替换成本地的路径</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="keyword">let</span> path = ENTER.payload</span><br><span class="line"><span class="comment">//路径为https://mixley.stdcdn.com/ 替换为应用中路径</span></span><br><span class="line"><span class="keyword">let</span> url=<span class="string">&quot;https://mixley.stdcdn.com/&quot;</span>;</span><br><span class="line"><span class="keyword">let</span> dic=<span class="string">&quot;C:/Users/micke/OneDrive/应用/PoweredBy.Cloud/mixley.stdcdn.com/&quot;</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">//图片下载保存路径</span></span><br><span class="line"><span class="keyword">let</span> imgdowndir=<span class="string">&quot;E:/mixley/Pictures/Saved Pictures/&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//定义获取UUID的方法</span></span><br><span class="line"><span class="keyword">let</span> getUUID=<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">  <span class="comment">//UUID来自UUID插件中算法</span></span><br><span class="line">  <span class="keyword">const</span> uuid = <span class="string">&#x27;xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx&#x27;</span>.replace(<span class="regexp">/[xy]/g</span>, <span class="function"><span class="params">c</span> =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">let</span> r = <span class="built_in">Math</span>.random() * <span class="number">16</span> | <span class="number">0</span></span><br><span class="line">    <span class="keyword">let</span> v = c === <span class="string">&#x27;x&#x27;</span> ? r : (r &amp; <span class="number">0x3</span> | <span class="number">0x8</span>)</span><br><span class="line">    <span class="keyword">return</span> v.toString(<span class="number">16</span>)</span><br><span class="line">  &#125;)</span><br><span class="line">  <span class="keyword">return</span> uuid;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//定义执行路径</span></span><br><span class="line"><span class="keyword">let</span> executePath=<span class="function"><span class="keyword">function</span>(<span class="params">path</span>)</span>&#123;</span><br><span class="line">  utools.copyText(path);</span><br><span class="line">  utools.simulateKeyboardTap(<span class="string">&#x27;v&#x27;</span>,utools.isMacOs() ? <span class="string">&#x27;command&#x27;</span> : <span class="string">&#x27;ctrl&#x27;</span>);</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">if</span>(path.indexOf(url)&gt;-<span class="number">1</span>)&#123;</span><br><span class="line">  path = path.replace(url,dic);</span><br><span class="line">  executePath(path);</span><br><span class="line">&#125;<span class="keyword">else</span>&#123;</span><br><span class="line"><span class="comment">//下面为下载图片后替换本地路径</span></span><br><span class="line">path = imgdowndir+getUUID()+<span class="string">&#x27;.png&#x27;</span>;</span><br><span class="line"><span class="comment">//下载</span></span><br><span class="line">utools.ubrowser.goto(ENTER.payload)</span><br><span class="line">  .wait(<span class="number">500</span>)</span><br><span class="line">  <span class="comment">//将Img截图，保存为png</span></span><br><span class="line">  .screenshot(<span class="string">&quot;img&quot;</span>, path)</span><br><span class="line">  .run(&#123; <span class="attr">show</span>: <span class="literal">false</span> &#125;)</span><br><span class="line">  .then(<span class="function">() =&gt;</span> &#123;</span><br><span class="line">    executePath(path)</span><br><span class="line">  &#125;)</span><br><span class="line">  .catch(<span class="function"><span class="params">err</span> =&gt;</span> &#123; utools.showNotification(err.message) &#125;)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p><img src="https://mixley.stdcdn.com/2021/07/752819242ad82d1fbeba89cc4c373144.png" alt="自动化设置"></p>
<p><strong>特别说明</strong></p>
<p>如果使用OD作为图床，再OD中找到应用文件夹，将它设置为始终在此设备保留，解决同步问题。</p>
<p><img src="https://mixley.stdcdn.com/2021/07/76e2576d1cca88aeaa6722fdbb5ca9ad.png" alt="设置始终在此设备上保留"></p>
<h3 id="解决重复步骤问题"><a href="#解决重复步骤问题" class="headerlink" title="解决重复步骤问题"></a>解决重复步骤问题</h3><p>先看下浏览器有哪些操作可以让我们后面进行使用。</p>
<h4 id="浏览器特定操作说明"><a href="#浏览器特定操作说明" class="headerlink" title="浏览器特定操作说明"></a>浏览器特定操作说明</h4><p>1、Ctrl+L可以进入到link栏，即浏览器的地址栏（大部分浏览器）。</p>
<p>2、输入<strong>javascript:指令</strong>可以执行对应页面对应的指令，如下指令在浏览器地址栏输入后可在当前页面显示时间戳(注意，**javascript:**无法可能粘贴到浏览器，可以先输入j，再复制粘贴后面的部分)</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line">javascript:(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;alert((<span class="keyword">new</span> <span class="built_in">Date</span>()).valueOf());&#125;)();</span><br></pre></td></tr></table></figure>

<p>3、选择文件的文件框选择中，如果输入互联网地址，系统会自动下载文件，并且跳转到对应的本地路径，但是可能存在下载多次。</p>
<p><img src="https://mixley.stdcdn.com/2021/07/a3c4c1f72933512e083a2404bd147a84.png" alt="选择文件"></p>
<h4 id="微信公众号特定DOM元素及操作分析"><a href="#微信公众号特定DOM元素及操作分析" class="headerlink" title="微信公众号特定DOM元素及操作分析"></a>微信公众号特定DOM元素及操作分析</h4><p>咱们不用分析太多微信的内部逻辑，就顺着微信公众号的操作来简化，咱们是为了简化操作不是为了破解。</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="comment">//获取到ueditor_0编辑器的上下文(iframe)</span></span><br><span class="line"><span class="built_in">document</span>.getElementById(<span class="string">&quot;ueditor_0&quot;</span>)</span><br><span class="line"><span class="comment">//下面为具体获取的document</span></span><br><span class="line"><span class="built_in">document</span>.getElementById(<span class="string">&quot;ueditor_0&quot;</span>).contentWindow.document</span><br><span class="line"><span class="comment">//说明，后面的document都是指上面这个方式获取的。</span></span><br></pre></td></tr></table></figure>

<figure class="highlight html"><table><tr><td class="code"><pre><span class="line"><span class="comment">&lt;!--这个是获取到的错误图片的大概结构，具体内容分析见下--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">section</span> <span class="attr">class</span>=<span class="string">&quot;page_image_error js_catchremoteimageerror js_uneditable custom_select_card js_uneditablemouseover custom_select_card_selected&quot;</span> <span class="attr">data-remoteid</span>=<span class="string">&quot;c1625917818338&quot;</span> <span class="attr">data-scene</span>=<span class="string">&quot;catch&quot;</span> <span class="attr">data-global</span>=<span class="string">&quot;0&quot;</span> <span class="attr">data-canretry</span>=<span class="string">&quot;1&quot;</span> <span class="attr">data-reason</span>=<span class="string">&quot;%E6%8B%89%E5%8F%96%E5%9B%BE%E7%89%87%E6%95%B0%E6%8D%AE%E5%A4%B1%E8%B4%A5&quot;</span> <span class="attr">data-imgtype</span>=<span class="string">&quot;img&quot;</span> <span class="attr">data-cacheurl</span>=<span class="string">&quot;https://mixley.stdcdn.com/2021/07/maven/clip_image010.jpg&quot;</span> <span class="attr">data-filename</span>=<span class="string">&quot;undefined&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:553px;height:153px;&quot;</span> <span class="attr">contenteditable</span>=<span class="string">&quot;false&quot;</span>&gt;</span><span class="comment">&lt;!--省略--&gt;</span><span class="tag">&lt;/<span class="name">section</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>1、 选中到错误的图片</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="comment">//获取方式1 可能存在多个，可以轮询。</span></span><br><span class="line"><span class="built_in">document</span>.getElementsByClassName(<span class="string">&quot;page_image_error&quot;</span>)[<span class="number">0</span>].click();</span><br><span class="line"><span class="comment">//获取选中图片</span></span><br><span class="line"><span class="built_in">document</span>.getElementsByClassName(<span class="string">&quot;page_image_error&quot;</span>)[<span class="number">0</span>];</span><br><span class="line"></span><br><span class="line"><span class="comment">//获取方式2 .js_msg_next 进行点击，模拟界面上 查看失败图片按钮，不建议</span></span><br><span class="line"><span class="built_in">document</span>.getElementsByClassName(<span class="string">&quot;js_msg_next&quot;</span>)[<span class="number">0</span>].click();</span><br><span class="line"><span class="comment">//获取选中图片</span></span><br><span class="line"><span class="built_in">document</span>.getElementsByClassName(<span class="string">&quot;custom_select_card_selected&quot;</span>)[<span class="number">0</span>];</span><br></pre></td></tr></table></figure>
<p>2、获取到错误图片的地址</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="comment">//读取元素中的data-cacheurl,直接使用dataset</span></span><br><span class="line"><span class="built_in">document</span>.getElementsByClassName(<span class="string">&quot;page_image_error&quot;</span>)[<span class="number">0</span>].dataset.cacheurl</span><br></pre></td></tr></table></figure>

<p>3、点击上传按钮</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="comment">//实际研究源码，是使用的jq，有兴趣的可以把图片下载后转base64，直接免打开上传按钮</span></span><br><span class="line"><span class="built_in">document</span>.getElementsByName(<span class="string">&quot;file&quot;</span>)[<span class="number">0</span>].click()</span><br></pre></td></tr></table></figure>

<p>4、粘贴并转换地址，这里使用替换图片路径为本地路径或者直接复制原地址</p>
<p>5、确定后上传，其余的步骤重复</p>
<h3 id="完整代码"><a href="#完整代码" class="headerlink" title="完整代码"></a>完整代码</h3><p>在uTools自动化工具中，我们编写代码</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="comment">//定义替换图片的本地路径</span></span><br><span class="line"><span class="keyword">let</span> url=<span class="string">&quot;https://mixley.stdcdn.com/&quot;</span>;</span><br><span class="line"><span class="keyword">let</span> dic=<span class="string">&quot;C:/Users/micke/OneDrive/应用/PoweredBy.Cloud/mixley.stdcdn.com/&quot;</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">//貌似会出现命令串行，需要暂停下</span></span><br><span class="line"><span class="keyword">let</span> sleep =<span class="function"><span class="keyword">function</span>(<span class="params">numberMillis</span>) </span>&#123; </span><br><span class="line">  <span class="keyword">let</span> now = <span class="keyword">new</span> <span class="built_in">Date</span>(); </span><br><span class="line">  <span class="keyword">let</span> exitTime = now.getTime() + numberMillis; </span><br><span class="line">  <span class="keyword">while</span> (<span class="literal">true</span>) &#123; </span><br><span class="line">    now = <span class="keyword">new</span> <span class="built_in">Date</span>(); </span><br><span class="line">    <span class="keyword">if</span> (now.getTime() &gt; exitTime) </span><br><span class="line">    <span class="keyword">return</span>; </span><br><span class="line">  &#125; </span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//此方法在浏览器中执行js语句，可以直接操作dom</span></span><br><span class="line"><span class="keyword">let</span> executeJs=<span class="function"><span class="keyword">function</span>(<span class="params">data</span>)</span>&#123;</span><br><span class="line">  <span class="keyword">let</span> d = <span class="string">&#x27;let url=&quot;&#x27;</span>+url+<span class="string">&#x27;&quot;;&#x27;</span>+</span><br><span class="line">  <span class="string">&#x27;let dic=&quot;&#x27;</span>+dic+<span class="string">&#x27;&quot;;&#x27;</span>;</span><br><span class="line">  <span class="comment">//进入到浏览器地址栏</span></span><br><span class="line">  utools.simulateKeyboardTap(<span class="string">&#x27;l&#x27;</span>,utools.isMacOs() ? <span class="string">&#x27;command&#x27;</span> : <span class="string">&#x27;ctrl&#x27;</span>);</span><br><span class="line">  <span class="comment">//这里不停下，可能会将文本复制到正文</span></span><br><span class="line">  sleep(<span class="number">100</span>);</span><br><span class="line">  <span class="comment">//本来是先输入j再输入后面的内容的，但是发现中文输入有问题，改为录入后删除</span></span><br><span class="line">  <span class="keyword">let</span> val=<span class="string">&quot;_javascript:(function()&#123;&quot;</span>+d+data+<span class="string">&quot;&#125;)();&quot;</span></span><br><span class="line">  utools.copyText(val);</span><br><span class="line">  utools.simulateKeyboardTap(<span class="string">&#x27;v&#x27;</span>,utools.isMacOs() ? <span class="string">&#x27;command&#x27;</span> : <span class="string">&#x27;ctrl&#x27;</span>);</span><br><span class="line">  sleep(<span class="number">20</span>);</span><br><span class="line">  utools.simulateKeyboardTap(<span class="string">&#x27;home&#x27;</span>,utools.isMacOs() ? <span class="string">&#x27;command&#x27;</span> : <span class="string">&#x27;ctrl&#x27;</span>);</span><br><span class="line">  sleep(<span class="number">20</span>);</span><br><span class="line">  utools.simulateKeyboardTap(<span class="string">&#x27;delete&#x27;</span>);</span><br><span class="line">  sleep(<span class="number">20</span>);</span><br><span class="line">  utools.simulateKeyboardTap(<span class="string">&#x27;enter&#x27;</span>);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//注意，execCommand已废弃，替代方法暂无。</span></span><br><span class="line"><span class="comment">//执行的内容，获取图片地址，注意，结尾需要分号; 别写//注释哦，否则无法执行</span></span><br><span class="line"><span class="keyword">let</span> urlPath=<span class="string">`</span></span><br><span class="line"><span class="string">let editDocument = document.getElementById(&quot;ueditor_0&quot;).contentWindow.document;</span></span><br><span class="line"><span class="string">let errorimg = editDocument.getElementsByClassName(&quot;page_image_error&quot;);</span></span><br><span class="line"><span class="string">/**将文本复制到剪贴板，后期浏览器废弃后，升级为其它方式**/</span></span><br><span class="line"><span class="string">let copyText=function(text)&#123;</span></span><br><span class="line"><span class="string">  let input = document.createElement(&#x27;input&#x27;);</span></span><br><span class="line"><span class="string">  input.setAttribute(&quot;value&quot;, text);</span></span><br><span class="line"><span class="string">  document.body.appendChild(input);</span></span><br><span class="line"><span class="string">  input.select();</span></span><br><span class="line"><span class="string">  document.execCommand(&quot;copy&quot;); </span></span><br><span class="line"><span class="string">  document.body.removeChild(input);</span></span><br><span class="line"><span class="string">&#125;;</span></span><br><span class="line"><span class="string">if(errorimg.length)&#123;</span></span><br><span class="line"><span class="string">  errorimg[0].click();</span></span><br><span class="line"><span class="string">  let cacheurl = errorimg[0].dataset.cacheurl;</span></span><br><span class="line"><span class="string">  /**替换为本地路径**/</span></span><br><span class="line"><span class="string">  cacheurl = cacheurl.replace(url,dic);</span></span><br><span class="line"><span class="string">  if(cacheurl.indexOf(dic)&gt;-1)&#123;</span></span><br><span class="line"><span class="string">    cacheurl=cacheurl.replaceAll(&quot;/&quot;, &quot;\\\\&quot;);</span></span><br><span class="line"><span class="string">  &#125;;</span></span><br><span class="line"><span class="string">  copyText(cacheurl);</span></span><br><span class="line"><span class="string">  /**此处使用模拟打开文件上传的方式，可以替换为其它，源码是操作base64的，我懒得解析了，够用**/</span></span><br><span class="line"><span class="string">  document.getElementsByName(&quot;file&quot;)[0].click();</span></span><br><span class="line"><span class="string">&#125;;</span></span><br><span class="line"><span class="string">`</span></span><br><span class="line"><span class="comment">//开始执行(可以写循环，全部执行完毕，判断条件)</span></span><br><span class="line">executeJs(urlPath);</span><br><span class="line"><span class="comment">//依据电脑性能停留不同的时间</span></span><br><span class="line">sleep(<span class="number">500</span>);</span><br><span class="line">utools.simulateKeyboardTap(<span class="string">&#x27;v&#x27;</span>,utools.isMacOs() ? <span class="string">&#x27;command&#x27;</span> : <span class="string">&#x27;ctrl&#x27;</span>);</span><br><span class="line"></span><br><span class="line"><span class="comment">//这里回车可以你自己按下去,继续使用前面提供的替换脚本，将图片快速下载，使用自带的下载比较慢</span></span><br><span class="line"><span class="comment">// sleep(20);</span></span><br><span class="line"><span class="comment">// utools.simulateKeyboardTap(&#x27;enter&#x27;);</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="演示效果"><a href="#演示效果" class="headerlink" title="演示效果"></a>演示效果</h2><p><img src="https://mixley.stdcdn.com/2021/07/5882273b259e21171750eacdc8a9d86f.gif" alt="动画3"></p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/1DC25F7.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/1DC25F7.html" class="post-title-link" itemprop="url">图片的由来与存储</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2021-07-09 00:11:05 / 修改时间：00:12:34" itemprop="dateCreated datePublished" datetime="2021-07-09T00:11:05+08:00">2021-07-09</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/learn/" itemprop="url" rel="index"><span itemprop="name">学习</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/learn/deep/" itemprop="url" rel="index"><span itemprop="name">深度</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/1DC25F7.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/1DC25F7.html" class="cy_cmt_count" data-xid="2021/1DC25F7.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>我们知道，计算机中的数据都是0和1，但是展示在我们屏幕上的却是多姿多彩，文字、图片、视频和游戏等等，0和1怎么变成我们从屏幕看到的内容的？</p>
<h2 id="黑白图片"><a href="#黑白图片" class="headerlink" title="黑白图片"></a>黑白图片</h2><p>假定，1=白色，0=黑色，我们现在就可以用0和1组合为一个黑白画面了</p>
<p>我们使用ps新建一个只有0、1的位图</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/1.png" alt="img"></p>
<p>图片新建完成如下（放大后效果）</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/2.png" alt="img"></p>
<p>假定我们直接按1表示白，0表示黑的方式排列，可以得到我们的存储结果</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/3.png" alt="img"></p>
<h2 id="图片存储格式"><a href="#图片存储格式" class="headerlink" title="图片存储格式"></a>图片存储格式</h2><p>我们按 OS/2 bmp 方式进行保存（win位图最初保存方式，且无压缩，这里面去除了ps自动生成的元信息）</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/4.png" alt="img"></p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">OS/2 bmp：</span><br><span class="line">0x00-0x01: 2byte 424D表示BMP格式</span><br><span class="line">0x02-0x05: 4byte 此文件大小是0x0030bit(注意高低位，低位在前)</span><br><span class="line">0x06-0x09: 4byte 保留位</span><br><span class="line">0x0A-0x0D: 4byte 偏移量，数据开始起点，图中数据从0x0020开始 </span><br><span class="line">0x0E-0x11: 4byte BITMAPINFOHEADER结构体大小(以下为结构体定义)，图中大小为0x000C（OS/2：12 | Windows DIB 40）</span><br><span class="line">0x12-0x13: 2byte 图像宽 图中为4像素</span><br><span class="line">0x14-0x15: 2byte 图像高 图中为2像素 </span><br><span class="line">0x16-0x17: 2byte 图像平面数 图中为1</span><br><span class="line">0x18-0x19: 2byte 一个像素有多少bit 图中为1</span><br><span class="line">0x1A-0x1C: 3byte 0表示的颜色BGR格式，图中为0x000000黑色</span><br><span class="line">0x1D-0x1F: 3byte 1表示的颜色BGR格式，图中为0xFFFFFF白色</span><br></pre></td></tr></table></figure>

<p>由于Windows默认的扫描的最小单位是4byte，所以bmp默认每行对齐是4的倍数，我们可以得到第一行的长度为宽度4*1分辨率*1位(bit)=4bit,对齐为byte时最小单位4byte，所以需要占用4byte，但仅前4个bit填充的值有效。</p>
<p>且bmp是从左下角开始扫码，从左到右，从下到上，二进制转换0101为5，1010为a</p>
<p>最终对应的结果在不对齐的情况下为a5a5，在对齐后补0的情况如下所示：</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">A0 00 00 00 50 00 00 00 A0 00 00 00 50 00 00 00</span><br></pre></td></tr></table></figure>

<p>但是ps等软件在生成时会有一些元信息，所以可能会出现对齐为4byte时不是补0的情况，在算法读取时会自动跳过，但是人眼进行查看时，会造成干扰，自己排除掉即可</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/5.png" alt="img"></p>
<p>上图中，6 7F、8 22 56 F3等数据都是干扰数据，可替换为0或者替换为其它内容。</p>
<h2 id="图片放大"><a href="#图片放大" class="headerlink" title="图片放大"></a>图片放大</h2><p>图片放大是在图片使用中最常使用的功能，我们从图片放大这个角度看下黑白颜色后面该怎么处理，尝试放大下面这个长宽2x2的黑白图</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/6.png" alt="img"></p>
<p>我们存储在电脑中的数据可以抽象理解为，长宽2个像素的</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/7.png" alt="img"></p>
<p>当我们将这个放大为长宽4个像素很好处理</p>
<p>![а о 11  е 011  11 ее  11 ее ](<a target="_blank" rel="noopener" href="https://mixley.stdcdn.com/2021/07/face/8">https://mixley.stdcdn.com/2021/07/face/8</a> .png)</p>
<p>我们得到的图片还是这样的没什么变化</p>
<p>但是当我们想将这个放大为长宽3像素呢？要知道，我们的图片放大缩小，从来都不是按倍数放大，动不动就直接放大2倍的，几乎没有。</p>
<p>可能我们得到的理想结果是</p>
<p>![e ø.5 1  ø.5 ø.5 ø.s ](<a target="_blank" rel="noopener" href="https://mixley.stdcdn.com/2021/07/face/9">https://mixley.stdcdn.com/2021/07/face/9</a> .png)</p>
<p>但是我们的01世界中，不存在0.5这种数据，按四舍五入或者退1法，我们可以得到这样的结果</p>
<p>![1 1 1 ](<a target="_blank" rel="noopener" href="https://mixley.stdcdn.com/2021/07/face/10">https://mixley.stdcdn.com/2021/07/face/10</a> .png)</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/11.png" alt="img"></p>
<p>但是这无疑是差距太大了，一个小的图片差距都如此大，更大一点的图片也会出现更大的偏差，无疑只使用黑白两个颜色是无法将图片的细节表述清楚的。</p>
<p>那么我们现在拓展下：0b00表示黑色，0b11表示白色，0b01与0b10表示灰色。这样在放大的时候可以有灰色填充，某些细节可以达到完善的程度了。（这只是一个极端例子，不用深究,我要表达的是0与1黑白中间拓展更多的颜色表达，让图片内容更加丰富）</p>
<h2 id="8位灰阶"><a href="#8位灰阶" class="headerlink" title="8位灰阶"></a>8位灰阶</h2><p>在计算机中，8位是1个字节，1byte=8bit，我们存储的最小单元几乎都是使用byte进行存储，8位灰阶就是将黑白颜色数据继续拓展，都是黑、灰、白色之间，有256个层次组成。</p>
<p>或许五彩斑斓的黑无法实现，但是层次分明的灰是可以达成的。</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/12.png" alt="img"></p>
<h2 id="彩色图片"><a href="#彩色图片" class="headerlink" title="彩色图片"></a>彩色图片</h2><p>层次分明的灰再怎么分明，都无法表达我们看到的真实颜色，光学三原色与颜料三原色中红、绿、蓝可以组合出所有颜色，依据无色系黑白灰+彩色系红绿蓝可以组合出任何颜色的特性，我们继续拓展到0和1中的队伍来。</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/13.jpeg" alt="img"></p>
<p>首先 红+绿+蓝，在RGB光学三原色中可以组成白色，所有颜色都不存在，则可以变成黑色。</p>
<p>按上图我们先简单扩展（自定义），3位表示3个颜色0b000表示白色 0b100 表示红色 0b010表示绿色，0b001表示蓝色，0b111是白色，对应的0b010+0b001=0b011，蓝+绿=青,0b110=红+绿=黄，0b101=红+蓝=紫。彩色出现了。</p>
<p>那么现在我们已经有了最基本的颜色后，我们依然需要进行图片的放大</p>
<p>看下面这个四像素的图片，我们依然希望放大</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/14.png" alt="img"></p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/15.png" alt="е10 001  тео оое "></p>
<p>图片的放大肯定不是相加，而是中间是一个过渡的颜色进行替换，我们现在使用最简单粗暴的替换颜色相加取中间值的方式处理。</p>
<p>以红绿中间的填充色为例（0b010+0b100）/2,应该是靠近这两个颜色中的颜色，结果是2.5，我们不能用0b010绿色去填充，也不能用0b100红色去填充，如果使用0b110,黄色，更是相差太远，在一个大的照片的放大过程中，尽量的贴合两边的颜色的中间颜色，应该是棕褐色，既有绿的过渡也需要红的过渡。(下图的展示可能不是很明显，也不很合适，因为图片的放大，极少有长宽2像素放大为长宽3像素这种操作，颜色直接的过渡也不会这么夸张。)</p>
<p><img src="https://mixley.stdcdn.com/2021/07/face/img.png" alt="img"></p>
<p>对于我们棕褐色，在我们刚才的拓展中，是不存在的，正如灰色在01表示的黑白中不存在，所以我们依然需要一个拓展来表达更多的颜色。</p>
<p>我们现在将颜色拓展为6个bit了，0b000000表示黑色，0b111111表示白色，其余的0b1100000是红，0b001100是绿，0b000011是蓝色。第0-2位的00-11中可以表达4种不同程度的红，黑（无红）、淡红、浅红、正红，其余的等同划分。</p>
<p>现在，差不多可以将棕色表达出来了，虽然依然不够细致，我们现在有2^6 = 64种颜色了。</p>
<h2 id="高彩色"><a href="#高彩色" class="headerlink" title="高彩色"></a>高彩色</h2><p>15或16位彩色（高彩色）：电脑所用的三原色是红、绿和蓝。在15位彩色中，每种原色有2^5 = 32个层次，共32768种颜色；而在16位彩色中，绿色有2^6=64个，共有65536个颜色</p>
<h2 id="真彩色"><a href="#真彩色" class="headerlink" title="真彩色"></a>真彩色</h2><p>24位彩色（真彩色）：每种原色都有256个层次，它们的组合便有256<em>256</em>256种颜色。</p>
<h2 id="32位彩色"><a href="#32位彩色" class="headerlink" title="32位彩色"></a>32位彩色</h2><p>32位彩色：除了24位彩色的颜色外，额外的8位是储存重叠图层的图形资料(alpha频道)。</p>
<p>另外有高动态范围影像(High Dynamic Range Image)，这种影像使用超过一般的256色阶来储存影像，通常来说每个像素会分配到32+32+32个bit来储存颜色资讯，也就是说对于每一个原色都使用一个32bit的浮点数来储存.</p>
<h2 id="补充"><a href="#补充" class="headerlink" title="补充"></a>补充</h2><p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/gwind/p/8215771.html">各种类型文件头标准编码</a></p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/1GB6XPC.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/1GB6XPC.html" class="post-title-link" itemprop="url">搭建Minio服务</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-07 22:54:10" itemprop="dateCreated datePublished" datetime="2021-07-07T22:54:10+08:00">2021-07-07</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-04-20 18:02:49" itemprop="dateModified" datetime="2022-04-20T18:02:49+08:00">2022-04-20</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/tool/" itemprop="url" rel="index"><span itemprop="name">工具</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/1GB6XPC.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/1GB6XPC.html" class="cy_cmt_count" data-xid="2021/1GB6XPC.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h2 id="minio介绍"><a href="#minio介绍" class="headerlink" title="minio介绍"></a>minio介绍</h2><blockquote>
<p>minio 是高性能、可扩展、云的原生支持、开源免费的企业级文件存储服务，与Amazon S3 兼容，配置极简。</p>
</blockquote>
<p>minio中文网：<a target="_blank" rel="noopener" href="http://www.minio.org.cn/">http://www.minio.org.cn/</a><br>minio官网：<a target="_blank" rel="noopener" href="https://min.io/">https://min.io/</a></p>
<h3 id="linux下配置"><a href="#linux下配置" class="headerlink" title="linux下配置"></a>linux下配置</h3><p><img src="https://mixley.stdcdn.com/2021/07/4af3675d787d672cf6bc725351405524.gif" alt="img"></p>
<p>1、下载minio，建议下载到/usr/local/bin/ 目录下，可全局访问</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">cd /usr/local/bin/</span><br><span class="line">wget   http://dl.minio.org.cn/server/minio/release/linux-amd64/minio</span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="comment">#连不上，使用下面的：wget   https://dl.minio.io/server/minio/release/linux-amd64/minio</span></span></span><br><span class="line"><span class="meta">#</span><span class="bash"><span class="comment">#还不行，试试：wget https://dl.min.io/server/minio/release/linux-amd64/minio</span></span></span><br><span class="line">chmod +x minio</span><br></pre></td></tr></table></figure>

<p>2、设置minio用户名密码到临时环境变量（重启后消失）</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">旧版使用 MINIO_ACCESS_KEY MINIO_SECRET_KEY，作废时间：Deprecated since version RELEASE.2021-04-22T15-44-28Z.</span></span><br><span class="line"><span class="meta">#</span><span class="bash">新版 配置用户名密码</span></span><br><span class="line">export MINIO_ROOT_USER=admin</span><br><span class="line">export MINIO_ROOT_PASSWORD=password</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">查看环境变量</span></span><br><span class="line">echo $MINIO_ROOT_USER</span><br><span class="line">echo $MINIO_ROOT_PASSWORD</span><br></pre></td></tr></table></figure>

<p>3、永久环境变量</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 修改系统配置</span></span><br><span class="line">vim /etc/profile</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">最后一行输入(新版)</span> </span><br><span class="line">export MINIO_ROOT_USER=admin</span><br><span class="line">export MINIO_ROOT_PASSWORD=password</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash"> 设置立即生效</span></span><br><span class="line">source /etc/profile</span><br></pre></td></tr></table></figure>

<p>4、指定配置路径后启动 （建议修改默认端口）</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">后端启动</span></span><br><span class="line">nohup minio server --address &#x27;:9000&#x27; --console-address &#x27;:9001&#x27; --config-dir /root/.minio /data/minio &gt; /data/minio.log 2&gt;&amp;1 &amp;</span><br><span class="line"><span class="meta">#</span><span class="bash">确认是否启动</span></span><br><span class="line">ps -ef | grep minio | grep -v grep</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">前端启动</span></span><br><span class="line">minio server --address &#x27;:9000&#x27; --console-address &#x27;:9001&#x27; --config-dir /root/.minio /data/minio</span><br><span class="line"><span class="meta">#</span><span class="bash">查看端口占用lsof -i:d</span></span><br><span class="line">lsof -i:9000</span><br><span class="line"></span><br><span class="line">docker run -p 9000:9000 minio server /data/minio</span><br><span class="line"></span><br><span class="line">docker run -p 29235:29235 -p 29236:29236  \</span><br><span class="line">  --name minio1 \</span><br><span class="line">  -e &quot;MINIO_ROOT_USER=minioUser&quot; \</span><br><span class="line">  -e &quot;MINIO_ROOT_PASSWORD=minioPassword&quot; \</span><br><span class="line">  -e &quot;MINIO_KMS_SECRET_KEY=my-minio-encryption-key:17Ej+Y0pA/BTjoTDom6W4ymEDIMNeDoB8ss83CtZVbE=&quot; \</span><br><span class="line">  -v /data/minio/dir:/data \</span><br><span class="line">  -v /data/minio/config:/root/.minio \</span><br><span class="line">  minio/minio server --address &#x27;:29235&#x27; --console-address &#x27;:29236&#x27; /data </span><br></pre></td></tr></table></figure>

<p>5、开机启动（方式很多，例举其一）</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash">修改系统配置</span></span><br><span class="line">vim /etc/rc.d/rc.local</span><br><span class="line">chmod +x /etc/rc.d/rc.local</span><br><span class="line"><span class="meta"></span></span><br><span class="line"><span class="meta">#</span><span class="bash">每次登录 vim /etc/profile</span></span><br><span class="line"><span class="meta">#</span><span class="bash">最后一行输入</span></span><br><span class="line">nohup minio server --address &#x27;:9000&#x27; --config-dir /root/.minio /data/minio &gt; /data/minio.log 2&gt;&amp;1 &amp;</span><br></pre></td></tr></table></figure>

<p>6、服务方式启动</p>
<p>来自博文：<a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_38431927/article/details/107377166">MinIO安装并将MinIO设置成服务启动</a></p>
<h3 id="win配置"><a href="#win配置" class="headerlink" title="win配置"></a>win配置</h3><p>1、下载minio，下载到C:\WINDOWS可全局启动</p>
<figure class="highlight powershell"><table><tr><td class="code"><pre><span class="line"><span class="comment">#powershell 命令直接下载，选定</span></span><br><span class="line">powershell (<span class="built_in">new-object</span> System.Net.WebClient).DownloadFile(<span class="string">&#x27;http://dl.minio.org.cn/server/minio/release/windows-amd64/minio.exe&#x27;</span>,<span class="string">&#x27;minio.exe&#x27;</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">### 下载时建议下载到环境变量，或者建议设置path路径，使用minio即可访问最好。</span></span><br></pre></td></tr></table></figure>

<p>2、设置minio用户名密码到临时环境变量（重启后消失）</p>
<figure class="highlight powershell"><table><tr><td class="code"><pre><span class="line"><span class="built_in">set</span> MINIO_ROOT_USER=admin</span><br><span class="line"><span class="built_in">set</span> MINIO_ROOT_PASSWORD=password</span><br><span class="line"></span><br><span class="line"><span class="comment">#查看环境变量</span></span><br><span class="line"><span class="built_in">echo</span> %MINIO_ROOT_USER%</span><br><span class="line"><span class="built_in">echo</span> %MINIO_ROOT_PASSWORD%</span><br></pre></td></tr></table></figure>

<p>3、永久环境变量（手动设置也比较简单）</p>
<figure class="highlight powershell"><table><tr><td class="code"><pre><span class="line"><span class="comment">#用户环境变量</span></span><br><span class="line">setx MINIO_ROOT_USER admin</span><br><span class="line">setx MINIO_ROOT_PASSWORD password</span><br><span class="line"></span><br><span class="line"><span class="comment">#系统环境变量(需管理员，建议)</span></span><br><span class="line">setx MINIO_ROOT_USER admin /m</span><br><span class="line">setx MINIO_ROOT_PASSWORD password /m</span><br><span class="line"></span><br><span class="line"><span class="comment">#以下指令保存为setMinio.bat后，自动获取管理员权限</span></span><br><span class="line">@<span class="built_in">echo</span> off</span><br><span class="line">%<span class="number">1</span>  %<span class="number">2</span>  mshta  vbscript:createobject(<span class="string">&quot;shell.application&quot;</span>).shellexecute(<span class="string">&quot;%~s0&quot;</span>,<span class="string">&quot;goto  :runas&quot;</span>,<span class="string">&quot;&quot;</span>,<span class="string">&quot;runas&quot;</span>,<span class="number">1</span>)(window.close)&amp;<span class="keyword">exit</span> </span><br><span class="line">:runas setMinio.bat</span><br><span class="line">setx MINIO_ROOT_USER admin /m</span><br><span class="line">setx MINIO_ROOT_PASSWORD password /m</span><br><span class="line"><span class="built_in">echo</span> MINIO_ROOT_USER=%MINIO_ROOT_USER%</span><br><span class="line"><span class="built_in">echo</span> MINIO_ROOT_PASSWORD=%MINIO_ROOT_PASSWORD%</span><br><span class="line">pause&amp;<span class="keyword">exit</span> </span><br></pre></td></tr></table></figure>

<p>4、指定配置路径后启动 （建议修改默认端口）</p>
<figure class="highlight powershell"><table><tr><td class="code"><pre><span class="line"><span class="comment">#静默启动(服务启动，以下命令设置服务为自动，开机后会自启动)</span></span><br><span class="line"><span class="built_in">set</span> confdir=<span class="string">&quot;D:\\data\\.minio&quot;</span></span><br><span class="line"><span class="built_in">set</span> datadir=<span class="string">&quot;D:\\data\\minio&quot;</span></span><br><span class="line"><span class="built_in">sc</span> create minio binpath=<span class="string">&quot;minio server --address &#x27;:9000&#x27; --config-dir %confdir% %datadir%&quot;</span> <span class="built_in">type</span>=own <span class="built_in">start</span>=auto displayname=minio</span><br><span class="line"><span class="comment">#启动服务 sc [start|stop|delete] server</span></span><br><span class="line"><span class="built_in">sc</span> <span class="built_in">start</span> minio</span><br><span class="line"><span class="comment">#查看服务状态</span></span><br><span class="line"><span class="built_in">sc</span> query minio</span><br><span class="line"></span><br><span class="line"><span class="comment">#cmd启动</span></span><br><span class="line">minio server -<span class="literal">-address</span> <span class="string">&#x27;:9000&#x27;</span> -<span class="literal">-config</span><span class="literal">-dir</span> D:\\data\\.minio D:\\data\\minio </span><br></pre></td></tr></table></figure>

<h3 id="其它事项"><a href="#其它事项" class="headerlink" title="其它事项"></a><strong>其它事项</strong></h3><h4 id="安装宝塔的linux下运行闪退"><a href="#安装宝塔的linux下运行闪退" class="headerlink" title="安装宝塔的linux下运行闪退"></a>安装宝塔的linux下运行闪退</h4><p>通过宝塔面板中系统加固功能检查管理进程白名单，不存在则加入到白名单</p>
<p><img src="https://mixley.stdcdn.com/2021/07/08727c087384727021d598511ea00803.png" alt="image-20210707230525365"></p>
<h4 id="win下使用cmd-minio-server无法启动解决办法"><a href="#win下使用cmd-minio-server无法启动解决办法" class="headerlink" title="win下使用cmd minio server无法启动解决办法"></a>win下使用cmd minio server无法启动解决办法</h4><p>1、若文件夹在本地，使用./minio server再重试</p>
<p>2、环境变量中设置path，指定minio目录路径</p>
<h4 id="win下执行命令时提示需要管理员权限"><a href="#win下执行命令时提示需要管理员权限" class="headerlink" title="win下执行命令时提示需要管理员权限"></a>win下执行命令时提示需要管理员权限</h4><p>方法1：可使用管理员命令窗口打开</p>
<p>方法2：参考<strong>永久环境变量</strong>，设置一个cmd脚本自动提升管理员权限</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/1PN15P4.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/1PN15P4.html" class="post-title-link" itemprop="url">使用PicGo搭建图床</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2021-07-07 21:23:03 / 修改时间：22:51:20" itemprop="dateCreated datePublished" datetime="2021-07-07T21:23:03+08:00">2021-07-07</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/tool/" itemprop="url" rel="index"><span itemprop="name">工具</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/1PN15P4.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/1PN15P4.html" class="cy_cmt_count" data-xid="2021/1PN15P4.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <p>我需要能帮助我管理图片的工具，让我的博客能在网络获取图片，我将使用OneDrive作为免费的图床。</p>
<blockquote>
<p><strong>PicGo: 一个用于快速上传图片并获取图片 URL 链接的工具</strong></p>
</blockquote>
<h2 id="调研"><a href="#调研" class="headerlink" title="调研"></a>调研</h2><p>经过了调研，PicGo实际并不提供存储，而是一个可以与博客工具配合的本地软件，他本身支持的格式能满足大部分，还可以支持插件。很赞的是，我发现了他有个Amazon S3插件，能支持Amazon S3格式，搜索S3就能得到它。</p>
<p><img src="https://mixley.stdcdn.com/2021/07/4ea848da27772395ab80ea6fb496dc6a.png" alt="PicGo插件中搜索S3插件"></p>
<p>Amazon S3 是一个产品，也是一个标准，我们使用的主流的存储产品，比如阿里云OSS、华为OSS、minio等都是支持S3标准的。这意味着，当我拥有这个替代我存储的工具，我将来的文件迁移是0成本的。</p>
<h3 id="为什么使用S3"><a href="#为什么使用S3" class="headerlink" title="为什么使用S3"></a>为什么使用S3</h3><blockquote>
<p>引用自：<a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/112057573">一文读懂 AWS S3</a></p>
<p>AWS S3 全名是 Simple Storage Service，简便的存储服务。为什么这么起名啊？它：</p>
<ol>
<li>提供了统一的接口 REST/SOAP 来统一访问任何数据</li>
<li>对 S3 来说，存在里面的数据就是对象名（键），和数据（值）</li>
<li>不限量，单个文件最高可达 5TB</li>
<li>高速。每个 bucket 下每秒可达 3500 PUT/COPY/POST/DELETE 或 5500 GET/HEAD 请求</li>
<li>具备版本，权限控制能力</li>
<li>具备数据生命周期管理能力</li>
</ol>
</blockquote>
<p>简单的说，S3更多是一个标准，使用S3后我们能无缝切换其它S3协议的服务，而目前大部分存储服务都是支持S3的！</p>
<h3 id="如何搭建s3存储服务"><a href="#如何搭建s3存储服务" class="headerlink" title="如何搭建s3存储服务"></a>如何搭建s3存储服务</h3><blockquote>
<p>引用自：<a target="_blank" rel="noopener" href="http://www.minio.org.cn/">minio</a></p>
<p>构建高性能的云原生数据<br>机器学习，大数据分析，海量存储的基础架构<br>MinIO支持各种应用程序数据工作负载<br>在中国：阿里巴巴、腾讯、百度、中国联通、华为、中国移动等等9000多家企业也都在使用MinIO产品</p>
</blockquote>
<p>你可以使用minio搭建高性能的存储服务。</p>
<h2 id="安装PicGo"><a href="#安装PicGo" class="headerlink" title="安装PicGo"></a>安装PicGo</h2><p><a target="_blank" rel="noopener" href="https://picgo.github.io/PicGo-Doc/zh/">PicGo</a>是开源产品，你可以在GitHub找到它，点击此处下载 <a target="_blank" rel="noopener" href="https://github.com/Molunerfinn/PicGo/releases">应用</a>。</p>
<p>这是一个应用，直接安装完成点击打开就可以运行了，它为Win、Linux、MacOS都提供了程序。</p>
<h2 id="配置PoweredBy-Cloud"><a href="#配置PoweredBy-Cloud" class="headerlink" title="配置PoweredBy.Cloud"></a>配置PoweredBy.Cloud</h2><p>PicGo是S3插件，需要一个支持S3的服务，当我们不想额外花费时，可以使用免费的方式，比如使用OneDrive提供的存储。PoweredBy.Cloud可以提供我们需要的服务。</p>
<h3 id="注册PoweredBy-Cloud"><a href="#注册PoweredBy-Cloud" class="headerlink" title="注册PoweredBy.Cloud"></a>注册PoweredBy.Cloud</h3><blockquote>
<p>引用自：<a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/376414195">免费把你的 GoogleDrive 和 OneDrive 变成图床</a></p>
<p>1、打开 PoweredBy.Cloud 并注册。注册非常简单，只需要提供一个可收邮件的邮箱，登录地址会发送到你的邮箱。<br>2、在邮箱里找到登录地址，并点击登录地址登录到 PoweredBy.Cloud。<br>3、在 PoweredBy.Cloud 的控制台里添加一个 site，例如 <a target="_blank" rel="noopener" href="http://demo.stdcdn.com,选择/">http://demo.stdcdn.com，选择</a> GoogleDrive 或者 OneDrive 作为存储空间。PoweredBy.Cloud 会在你的网盘里创建一个 <a target="_blank" rel="noopener" href="http://demo.stdcdn.com/">http://demo.stdcdn.com</a> 的文件夹。</p>
</blockquote>
<p>注册site截图如下，Site Name将在后面使用</p>
<p><img src="https://mixley.stdcdn.com/2021/07/5328e699c03243c4c8abff5f4c172f1d.png" alt="在PoweredBy.Cloud中创建你的站点名称"></p>
<h3 id="创建Developer密钥-S3"><a href="#创建Developer密钥-S3" class="headerlink" title="创建Developer密钥(S3)"></a>创建Developer密钥(S3)</h3><p>点击Developer选项-&gt;点击 Create Access Key 按钮-&gt;输入任意key名称(仅做备注)</p>
<p><img src="https://mixley.stdcdn.com/2021/07/0f88e1fa24fef8197afb6ec55d8ca7a2.png" alt="image-20210707222843012"></p>
<h3 id="配置PicGo的S3"><a href="#配置PicGo的S3" class="headerlink" title="配置PicGo的S3"></a>配置PicGo的S3</h3><p>配置S3的关键参数在创建密钥后，access_key、secret_access_key都已经出现，剩下的还有两个关键值</p>
<figure class="highlight js"><table><tr><td class="code"><pre><span class="line"><span class="comment">//下面是两个关键参数</span></span><br><span class="line"><span class="comment">//固定值,endpoint 自定义节点</span></span><br><span class="line">endpoint_url=<span class="string">&#x27;https://stdcdn.com&#x27;</span></span><br><span class="line"><span class="comment">//桶,bucketName 这就是你的SiteName。</span></span><br><span class="line">bucket=<span class="string">&quot;mixley&quot;</span></span><br></pre></td></tr></table></figure>

<p><img src="https://mixley.stdcdn.com/2021/07/c4243fe369515cc8acd8084d8c18c29e.png" alt="配置S3"></p>
<h3 id="测试图片上传效果"><a href="#测试图片上传效果" class="headerlink" title="测试图片上传效果"></a>测试图片上传效果</h3><p>我们使用PicGo测试上传效果，最终会在我们的OneDrive中出现。</p>
<p><img src="https://mixley.stdcdn.com/2021/07/fd3283b3a953c78e88540cf9e3fc20f6.png" alt="配置完成后测试上传的图片位置"></p>
<h2 id="Typora中使用PicGo"><a href="#Typora中使用PicGo" class="headerlink" title="Typora中使用PicGo"></a>Typora中使用PicGo</h2><p>Typora中，可以在图像中配置上传图片，并且上传可以进行验证图片上传选项操作。</p>
<p><img src="https://mixley.stdcdn.com/2021/07/1d10d4fb89ddeaaa2771a0f7494a962e.png" alt="image-20210707224953978"></p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://mixley.github.io/2021/1TBZ6GQ.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="mixley">
      <meta itemprop="description" content="全栈·架构设计·算法">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="mixley">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/2021/1TBZ6GQ.html" class="post-title-link" itemprop="url">明史·海瑞传</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2021-07-05 23:36:37 / 修改时间：23:46:29" itemprop="dateCreated datePublished" datetime="2021-07-05T23:36:37+08:00">2021-07-05</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/learn/" itemprop="url" rel="index"><span itemprop="name">学习</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/learn/cww/" itemprop="url" rel="index"><span itemprop="name">语文老师</span></a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Changyan：</span>
    
    
      <a title="changyan" href="/2021/1TBZ6GQ.html#SOHUCS" itemprop="discussionUrl">
        <span id="url::https://mixley.github.io/2021/1TBZ6GQ.html" class="cy_cmt_count" data-xid="2021/1TBZ6GQ.html" itemprop="commentCount"></span>
      </a>
    
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h2 id="明史·海瑞传"><a href="#明史·海瑞传" class="headerlink" title="明史·海瑞传"></a>明史·海瑞传</h2><h3 id="来源声明"><a href="#来源声明" class="headerlink" title="来源声明"></a>来源声明</h3><p>2022届高三一轮复习之文言文整体阅读题目</p>
<p>试卷问题网络位置：<a target="_blank" rel="noopener" href="http://cooco.net.cn/question/11748.html">可圈可点(微信收费)</a>、<a target="_blank" rel="noopener" href="https://baijiahao.baidu.com/s?id=1694794526031280061">百度百家号</a>，非原创，联系侵删。</p>
<h3 id="原文"><a href="#原文" class="headerlink" title="原文"></a>原文</h3><p>海瑞，字汝贤，琼山人。举乡试。署南平教谕，迁淳安知县。布袍脱粟，令老仆艺蔬自给。<strong>总督胡宗宪尝语人曰昨闻海令为母寿市肉二斤矣都御史鄢懋卿行部过供具甚薄抗言邑小不足容车马懋卿恚甚然素闻瑞名为敛威去</strong>久之，陆光祖为文选，擢瑞户部主事。时世宗享国日久，不视朝，深居西苑，专意斋醮。督抚大吏争上符瑞，礼官辄表贺，瑞独上疏。帝得疏，大怒，抵之地，顾左右曰：“趣执之，无使得遁！”宦官黄锦在侧曰：“此人素有痴名。闻其上疏时，自知触忤当死，市一棺，诀妻子，待罪于朝，僮仆亦奔散无留者，是不遁也。”帝默然。少顷复取读之，日再三，为感动太息，留中者数月。</p>
<p>遂逮瑞下诏狱，究主使者。帝初崩，外庭多未知。提牢主事闻状，以瑞且见用，设酒馔款之。瑞自疑当赴西市，恣饮啖，不顾。主事因附耳语：“宫车适晏驾，先生今即出大用矣。”即大恸，陨绝于地。既释，复故官。帝屡欲召用瑞，执政阴沮之，乃以为南京右都御史。<strong>诸司素偷惰，瑞以身矫之。有御史偶陈戏乐，欲遵太祖法予之杖。</strong>百司惴恐，多患苦之。提学御史房寰恐见纠擿，欲先发，给事中钟宇淳复怂恿，寰再上疏丑诋。瑞亦屡疏乞休，慰留不允。十五年，卒官。瑞无子。卒时，佥都御史王用汲入视，葛帏敝籯，有寒士所不堪者。因泣下，醵金为敛。<strong>小民罢市。丧出江上，白衣冠送者夹岸，酹而哭者百里不绝。</strong>瑞生平为学，以刚为主，因自号刚峰，天下称刚峰先生。故所至力行清丈，颁一条鞭法。意主于利民，而行事不能无偏云。</p>
<p>（节选自《明史·海瑞传》）</p>
<h3 id="题目"><a href="#题目" class="headerlink" title="题目"></a>题目</h3><p>10．下列对文中画波浪线部分的断句，正确的一项是（ ）</p>
<p>A．总督胡宗宪尝语人曰/昨闻海令为母寿/市肉二斤矣/都御史鄢懋卿行部过/供具甚薄/抗言邑小不足容车马/懋卿恚甚/然素闻瑞名/为敛威去/</p>
<p>B．总督胡宗宪尝语人曰/昨闻海令为母寿/市肉二斤矣/都御史鄢懋卿行部过/供具甚薄/抗言邑小不足容车马/懋卿恚甚然/素闻瑞名/为敛威去/</p>
<p>C．总督胡宗宪尝语人曰/昨闻海令/为母寿市肉二斤矣/都御史鄢懋卿行部过/供具甚薄/抗言邑小不足容车马/懋卿恚甚/然素闻瑞名/为敛威去/</p>
<p>D．总督胡宗宪尝语人曰/昨闻海令/为母寿市肉二斤矣/都御史鄢懋卿行部过/供具甚薄/抗言邑小不足容车马/懋卿恚甚然/素闻瑞名/为敛威去/</p>
<p>11．下列对文中加点词语的相关内容的解说，不正确的一项是（ ）</p>
<p>A．乡试是中国古代科举考试之一，由各地州、府主持，考生来自全国各地。</p>
<p>B．宦官也称太监，是古代宫中侍奉皇帝及其家属的人员，由阉割后的男子充任。</p>
<p>C．晏驾是帝王死去的委婉说法，“晏”义为晚，晏驾指帝王车驾未能按时发出。</p>
<p>D．执政指掌管国家政事，又指执掌国家大权的重臣，还可作为高级官员的通称。</p>
<p>12．下列对原文有关内容的概括和分析，不正确的一项是（ ）</p>
<p>A．海瑞生活俭朴，时时关心国事。他担任淳安知县时，布衣粗食，老仆种菜；任职户部时，见皇上深居西苑，不亲理朝政，又独自上奏劝谏。</p>
<p>B．海瑞劝谏皇上，不惧以死报国。皇上得疏大怒，命令火速捉拿，不要让他逃遁，但得知海瑞待罪于朝不会逃跑后，又细读疏文，并感动叹息。</p>
<p>C．海瑞严厉执法，受到小人诋毁。他任南京右都御史时，因要求严明，部下怨恨，部属房寰惧遭揭发，又受怂恿，上疏诋毁，致使海瑞被迫退休。</p>
<p>D．海瑞为人刚直，身后穷困窘迫。他生平以刚为主，虽然一心为民，但行事却有偏颇；他一生清廉自律，家境贫寒，死后竟至靠人凑钱殓葬。</p>
<p>13．把文中画横线的句子翻译成现代汉语。</p>
<p>（1）诸司素偷惰，瑞以身矫之。有御史偶陈戏乐，欲遵太祖法予之杖。</p>
<p>（2）小民罢市。丧出江上，白衣冠送者夹岸，酹而哭者百里不绝。</p>
<p>14．海瑞在向明世宗上疏前，为什么要事先“市一棺，诀妻子”？请简要说明。</p>
<h3 id="阅读答案"><a href="#阅读答案" class="headerlink" title="阅读答案"></a>阅读答案</h3><h4 id="【答案】"><a href="#【答案】" class="headerlink" title="【答案】"></a>【答案】</h4><p>10．A</p>
<p>11．A</p>
<p>12．C</p>
<p>13．（1）众多官吏一向偷安怠惰，海瑞以自己的行动加以纠正。有御史偶尔演戏奏乐，海瑞将要遵照太祖法规对他杖责。</p>
<p>（2）市民停业悼念。灵柩经过江面，民众穿戴白衣帽两岸送行，洒酒祭奠而哭的人百里不绝。</p>
<p>14．①自知触怒皇帝将死；②抱定必死的决心。</p>
<h4 id="【分析】"><a href="#【分析】" class="headerlink" title="【分析】"></a>【分析】</h4><p>10．本题考查文言文断句能力。</p>
<p>解答本题注意各选项间不同之处。“昨闻海令为母寿”，是一个完整的句子，中间不宜断开，排除C项、D项；“然”表转折，与后文关系密切，所以应在它之前断开，排除B项。</p>
<p>画波浪线部分句意为：总督胡宗宪曾经告诉别人说：“昨天我听说海县令为母亲祝寿，只买了二斤肉。”都御史（官职名）鄢懋卿从淳安县经过，海瑞对他们的招待都很简陋，说淳安县地方太小容不下车马。鄢懋卿非常愤恨。但是一直都听说过海瑞的名声，只好收敛威风离开了。</p>
<p>故选A。</p>
<p>11．本题考查文化常识。</p>
<p>A项，“考生来自全国各地”错误，考生为本地人。故选A。</p>
<p>12．</p>
<p>本题考查筛选并整合文中信息，归纳内容要点、概括中心意思的能力。</p>
<p>C项，“致使海瑞被迫退休”说法错误，原文为“瑞亦屡疏乞休，慰留不允”，皇上劝慰他，不让他辞官，并未“被迫退休”。</p>
<p>故选C。</p>
<p>13．本题考查理解并翻译文中的句子的能力。</p>
<p>（1）中“素”，一向；“矫”，矫正，纠正；“杖”，名词用作动词，杖责。</p>
<p>（2）中“罢市”，停业；“丧”，灵柩；“白衣冠”，名词用作动词，穿白衣戴白帽；“酹”，洒酒祭奠。</p>
<p>14．本题考查筛选并整合文章信息。</p>
<p>由“自知触忤当死”可知他自知触怒皇帝将死，所以买了一口棺材，诀别妻子儿女；</p>
<p>由“待罪于朝，僮仆亦奔散无留者，是不遁也”可知他抱定了必死的决心，并不打算逃走，而是遣散童仆，等待皇上降罪。</p>
<h3 id="译文"><a href="#译文" class="headerlink" title="译文"></a>译文</h3><p>海瑞，字汝贤，琼山人。乡试中举。（海瑞）代理南平县教谕，升任淳安县知县，在任上穿布衣，吃粗米，让家中老仆种菜自给。总督胡宗宪曾经告诉别人说：“昨天我听说海县令为母亲祝寿，只买了二斤肉。”都御史（官职名）鄢懋卿从淳安县经过，海瑞对他们的招待都很简陋，说淳安县地方太小容不下车马。鄢懋卿非常愤恨。但是一直都听说过海瑞的名声，只好收敛威风离开了。过了一段时间，陆光祖任吏部文选清吏司郎中，他提拔海瑞为户部主事。当时世宗在位时日已久，不再上朝听政，深居皇宫西苑，专心一意斋戒祀神。总督巡抚大臣争相进献各种祥瑞征兆，礼部官员往往就此上表祝贺，唯独海瑞一人上疏。世宗皇帝看了奏章大怒，把它扔到地下，回头对身边的宦官说：“赶紧把他抓起来，别让他跑了。”宦官黄锦在一旁说：“此人一向有痴名。听说他上疏时，自己知道冒犯皇上难免一死，就买了一口棺材，诀别妻子儿女，在朝廷待罪，家中僮仆也都是打发走了没有留一个，这表明他并不打算逃走。”世宗皇帝沉默不语。</p>
<p>过了一会儿，皇帝又拿出奏章来看，（就这样）一天之中看了两三次，被感动而叹息，将它留在宫中数月。于是命令逮捕海瑞，关进诏狱，追究主使他上疏的人。世宗刚去世时，外界多不知道。而监狱主事听到消息，估计海瑞将会受到任用，因此办了酒菜款待海瑞。海瑞怀疑以为要赴西市刑场斩首，于是就恣意饮食，没有顾及其它。提牢主事这时贴着海瑞耳语：“皇上适才已经驾崩，您马上就要出狱，受到重用了。”海瑞随即十分哀恸，晕倒在地。海瑞获释后，恢复了原来的官职。神宗数次想召用海瑞，但被执政的大臣暗地里阻止了，只当了南京右都御史。众多官吏一向偷安怠惰，海瑞以自己的行动加以纠正。有御史偶尔演戏奏乐，海瑞将要遵照太祖法规对他杖责。</p>
<p>官员们惶恐不安，多对此叫苦不迭。提学御史房寰，担心被检举揭露，想先下手发难，给事中钟宇淳又从中怂恿，房寰便二次上疏诬蔑海瑞。海瑞也屡次上疏要求告老回家，皇上劝慰他，不让他辞官。万历十五年，海瑞死于南京任上。海瑞没有儿子。去世之时，佥都御史王用汲前来探视，见他房中只有葛布做的帐子和空箱笼，过着一般寒士都不能忍受的生活。因而感动得流了泪，出面凑钱作为敛棺之用。市民停业悼念。灵柩经过江面，民众穿戴白衣帽两岸送行，洒酒祭奠而哭的人百里不绝。海瑞平生治学，以刚为主，因此自号为刚峰，天下人称他为刚峰先生。所以所到之处均致力于清丈土地，颁行一条鞭法。他的思想主要在于利民，而行事很难避免会出现一些偏差。</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  


  
  <nav class="pagination">
    <a class="extend prev" rel="prev" href="/page/3/"><i class="fa fa-angle-left" aria-label="上一页"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/3/">3</a><span class="page-number current">4</span><a class="page-number" href="/page/5/">5</a><a class="extend next" rel="next" href="/page/5/"><i class="fa fa-angle-right" aria-label="下一页"></i></a>
  </nav>



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">mixley</p>
  <div class="site-description" itemprop="description">全栈·架构设计·算法</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">43</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">19</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">10</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">mixley</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  

  <script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=cyvxnSprz"></script>


</body>
</html>
